From 7cb7729c3fb69c33d1c7fcd4b671585fb11b87b8 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Thu, 6 Apr 2006 20:54:33 +0000 Subject: [PATCH] fix rounding error + atan(0,0) instability --- gpsbabel/garmin_txt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gpsbabel/garmin_txt.c b/gpsbabel/garmin_txt.c index 1be486c64..b6b19fb9e 100644 --- a/gpsbabel/garmin_txt.c +++ b/gpsbabel/garmin_txt.c @@ -296,6 +296,7 @@ course_rad(double lat1, double lon1, double lat2, double lon2) v1 = sin(lon1 - lon2) * cos(lat2); v2 = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1 - lon2); if (fabs(v2) < 0.000000000000001) v2 = 0.0; /* fix calculation diff. between 32- and 64-bit systems */ + if (fabs(v1) < 0.000000000000001) v1 = 0.0; /* fix calculation diff. between 32- and 64-bit systems */ return atan2(v1, v2); } -- 2.30.2